#!/bin/bash

###########################################
#安装 jetty-12.0.6
###########################################

#安装基础依赖
yum install -y java-1.8.0-openjdk-devel vim maven gcc make
# 验证版本
java -version
mvn -version

#设置 maven 镜像源
vim /usr/share/maven/conf/settings.xml
# 修改<mirror></mirror>标签为以下内容
    <mirror>
      <id>aliyunmaven</id>
      <name>aliyun public</name>
      <url>https://maven.aliyun.com/repository/public</url>
      <mirrorOf>central</mirrorOf>
    </mirror>

###########################################
#1.下载源码
cd /home
git clone https://github.com/quartz-scheduler/quartz.git
cd quartz
git checkout quartz-2.1.7
git log -1
#2.使用Maven进行编译（跳过测试以加快编译速度）
mvn clean package -DskipTests
#3.安装
mkdir -p /usr/local/quartz/lib
cp quartz/target/quartz-2.1.7.jar /usr/local/quartz/lib/
#4.配置环境变量
echo "export QUARTZ_HOME=/usr/local/quartz" >> ~/.bashrc
echo "export CLASSPATH=$CLASSPATH:$QUARTZ_HOME/lib/quartz-2.1.7.jar" >> ~/.bashrc
source ~/.bashrc

#############################################
#运行验证
#############################################
# 编译结果位于build/libs目录
cd /home/quartz
ls quartz/target/quartz-2.1.7.jar
# 查看Quartz核心JAR包中的类
jar -tf quartz/target/quartz-2.1.7.jar | grep org/quartz/impl/StdSchedulerFactory.class









